package cn.kgc.mushroomwebui.controller;

import cn.kgc.mushroomcommon.api.ManagerRemoteService;
import cn.kgc.mushroomcommon.pojo.Order;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@RequestMapping("/order")
@RestController
public class OrderController {

    @Resource
    ManagerRemoteService managerRemoteService;

    @RequestMapping("/selectOrderAndComm")
    public List<Order> selectOrderAndComm(@RequestParam(value = "ordenum",required = false,defaultValue = "")String ordenum){
        List<Order> orders = managerRemoteService.selectOrderAndComm(ordenum);
        return orders;
    }

    @RequestMapping("deleteOrder")
    public Map<String,Object> deleteOrder(@RequestParam("id")Integer id){
        Map<String, Object> objectMap = managerRemoteService.deleteOrder(id);
        return objectMap;
    }

    @RequestMapping("/insertOrder")
    public Integer insertOrder(@RequestBody Order order){
        return managerRemoteService.insertOrder(order);
    }


}
